If Variable = True show this, else show this [on hold]

Posted by Tim Marshall on Pro Webmasters See other posts from Pro Webmasters or by Tim Marshall
Published on 2014-06-08T07:56:59Z Indexed on 2014/06/08 15:45 UTC
Read the original article Hit count: 220

Filed under:

If my variable of $userLoggedIn is true, the <?php if ($userLoggedIn == 'true') : ?> works perfect, however if the variable is false, the <?php if ($userLoggedIn == 'false') : ?> does not work at all.

How do I resolve this problem?

<?php
$EditingWagesPage = false;
$userLoggedIn = false;
?>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->

<?php if ($userLoggedIn == 'true') : ?>
<head>
      ** HEADER STUFF **
</head>
<body>
      ** BODY STUFF **
</body>
<?php endif;?>
<?php if ($userLoggedIn == 'false') : ?>
<head>
</head>
<body>
hiya
</body>
<?php endif;?>

</html>

© Pro Webmasters or respective owner

Related posts about php